package com.ruoyi.web.shopping.service.impl;

import com.ruoyi.web.shopping.dto.DiscountMaxDTO;
import com.ruoyi.web.shopping.dto.SaleDTO;
import com.ruoyi.web.shopping.mapper.SaleMapper;
import com.ruoyi.web.shopping.service.SaleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;

@Service
public class SaleServiceImpl implements SaleService {

    @Autowired
    private SaleMapper saleMapper;

    /**
     * 通过活动名称查询销售额
     *
     * @param disName
     * @return
     */
    @Override
    public ArrayList<SaleDTO> selectByName(String disName) {
        ArrayList<SaleDTO> saleDTOs = saleMapper.selectByName(disName);
        return saleDTOs;
    }

    /**
     * 查询销售额最高
     *
     * @return
     */
    @Override
    public DiscountMaxDTO selectMax() {
        DiscountMaxDTO discountMaxDTO = saleMapper.selectMax();
        return discountMaxDTO;
    }
}
